<?php $id=uniqid();?>
<form class="form-horizontal validate"  role="form" method="post" action="content/savearticle">
	<input type="hidden" name="id" value="<?php echo $rs['id']?>">
	<ul class="nav nav-tabs bordered" style="margin-top:0;padding-top:0" id="goods_tab">
		<li class="active"><a href="#basic" data-toggle="tab"><span class="hidden-xs">基本信息</span></a></li>
		<li><a href="#description" data-toggle="tab"><span class="hidden-xs">内容详情</span></a></li>
		<!--li><a href="#config" data-toggle="tab"><span class="hidden-xs">显示设置</span></a></li-->
	</ul>
	<div class="tab-content">
		<div class="tab-pane active" id="basic">
        	<div class="form-group">
				<label class="col-sm-2 control-label">所属分类</label>
				<input type="hidden" name="category_id" value="<?php echo $rs['category_id']?>" />
				<div class="col-sm-8">
					<div class="dropdown">
						<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown"><span id="cateName"><?php echo $rs['cateName']?$rs['cateName']:'无分类';?></span> <span class="caret"></span></button>
						<div class="dropdown-menu">
							<div class="scrollable" data-height="150" data-width="300">
								<div id="cateTree" class="aciTree aciTreeFullRow" style="min-height: 70px;"></div>
							</div>
						</div>
					</div>
				</div>
                <div class="col-sm-2">
					<button type="button" class="btn btn-green btn-lg btn-block btn-icon save">立即发布 <i class="entypo-check"></i></button>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">标题：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control input-lg easyui-validatebox" id="biaoti" name="title" value="<?php echo $rs['title']?>" data-options="required:true">
				</div>
				
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">URL自定义：</label>
				<div class="col-sm-10">
					<input type="text" class="form-control input-lg easyui-validatebox"  name="en_title" value="<?php echo $rs['en_title']?>" 
					data-options="required:true,validType:{remote:['<?php echo WEB.'content/ispinyin?id='.$rs['id']?>','en_title']},invalidMessage:'URL已存在，请修改'">
				</div>
			</div>
			
			<div class="form-group">
				<label class="col-sm-2 control-label">图片相册:</label>
				<div class="col-sm-10">
				 <div style="height:60px;color:#fff; background:#F30;padding:5px;">微信图片提示：<br>【1】上传的封面头图，图片尺寸官方建议的是360*200像素。<br />【2】多图文的二级缩略图是四方型显示的，那么图片最佳尺寸为200*200，或者宽、高相等不超过500为好。
				</div>
					<div class="panel panel-default" data-collapsed="0">
						<div class="panel-heading" style="min-height:50px;border:1px solid #cecece">
							<div class="panel-title"><button class="btn btn-blue" id="uploadBtn"><i class="entypo-upload"></i> 上传图片</button><span style="padding-left:15px">默认第一张图片为主图，可拖放更改顺序</span></div>
						</div>
						<div class="panel-body" style="height:130px;padding-top:20px">
							<div class="gallery-env">
								<?php if($rs['thumb']){foreach(json_decode($rs['thumb'],true) as $v){ ?>
								<div class="col-sm-2 col-xs-4">
									<article class="image-thumb">
										<a href="#" class="image"><img src="../<?php echo $v.'?time='.uniqid();?>" /></a>
										<input type="hidden" name="thumb[]" value="<?php echo $v?>">
										<div class="image-options">
											<a href="javascript:;" class="edit" onclick="Core.editPhoto('<?php echo $v?>')"><i class="entypo-pencil"></i></a>
											<a href="#" class="delete"><i class="entypo-cancel"></i></a>
										</div>
									</article>
								</div>
								<?php }}?>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">作者:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="author" value="<?php echo $rs['author']?>">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">来源:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="source" data-validate="url" value="<?php echo $rs['source']?>">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">SEO关键字:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="keywords" data-validate="url" value="<?php echo $rs['description']?>">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">SEO描述:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="description" data-validate="url" value="<?php echo $rs['description']?>">
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">排序:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="orderby" value="<?php echo $rs['orderby']?>">
					<span style="color:red">*注：倒序排序，数据越大越靠前</span>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">跳转连接:</label>
				<div class="col-sm-10">
					<input type="text" class="form-control easyui-validatebox" name="direct" data-validate="url" value="<?php echo $rs['direct']?>">
				</div>
			</div>
		</div>
		<div class="tab-pane" id="description">
			<div class="form-group">
				<label class="col-sm-2 control-label">简介(摘要):</label>
				<div class="col-sm-10">
					<textarea name="remark" rows="4" class="form-control easyui-validatebox"><?php echo $rs['remark']?></textarea>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">内容:</label>
				<div class="col-sm-10">
					<textarea id="<?php echo $id?>" style="height:300px" name="content"><?php echo $rs['content']?></textarea>
				</div>
			</div>
		</div>
		<!--div class="tab-pane" id="config">
			<div class="form-group">
				<label class="col-sm-2 control-label">显示到PC网站:</label>
				<div class="col-sm-10">
					<input type="checkbox" name="show_pc" value="1" <?php echo !$rs['id']||$rs['show_pc']==1?'checked':''; ?>/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">显示到APP和手机网站:</label>
				<div class="col-sm-10">
					<input type="checkbox" name="show_app" value="1" <?php echo !$rs['id']||$rs['show_app']==1?'checked':''; ?>/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-2 control-label">显示到微信:</label>
				<div class="col-sm-10">
					<?php $s=unserialize($rs['show_wechat']); foreach($sites as $v){?>
					<input type="checkbox" name="show_wechat[]" value="<?php echo $v['id']?>" <?php echo !$rs['id']||in_array($v['id'],$s)?'checked':''; ?>/> <span style="padding-right:20px"><?php echo $v['name']?></span>
					<?php }?>
				</div>
			</div>
		</div>
	</div-->

	
	
	
	
    <!--div class="form-group">
		<label class="col-sm-2 control-label">终端显示:</label>
		<div class="col-sm-2" style="color:#333">
			显示到PC:
            <div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_pc']!=2?'active':''?>"><input type="radio" name="show_pc" value="1" <?php echo $rs['show_pc']!=2?'checked':''?>>是</label>
				<label class="btn btn-default <?php echo $rs['show_pc']==2?'active':''?>"><input type="radio" name="show_pc" value="2" <?php echo $rs['show_pc']==2?'checked':''?>>否</label>
			</div>
		</div>
		<div class="col-sm-2" style="color:#333">
            显示到APP:
            <div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_app']!=2?'active':''?>"><input type="radio" name="show_app" value="1" <?php echo $rs['show_app']!=2?'checked':''?>>是</label>
				<label class="btn btn-default <?php echo $rs['show_app']==2?'active':''?>"><input type="radio" name="show_app" value="2" <?php echo $rs['show_app']==2?'checked':''?>>否</label>
			</div>
		</div>
		<div class="col-sm-4" style="color:#333">
			显示到微信:
			<div class="btn-group" data-toggle="buttons">
				<label class="btn btn-default <?php echo $rs['show_wechat']!=1?'active':''?>"><input type="radio" name="show_wechat" value="1" <?php echo $rs['show_wechat']!=1?'checked':''?>>不显示</label>
				<label class="btn btn-default <?php echo $rs['show_wechat']==2?'active':''?>"><input type="radio" name="show_wechat" value="2" <?php echo $rs['show_wechat']==2?'checked':''?>>当前微信</label>
				<label class="btn btn-default <?php echo $rs['show_wechat']==3?'active':''?>"><input type="radio" name="show_wechat" value="3" <?php echo $rs['show_wechat']==3?'checked':''?>>所有微信</label>
			</div>
		</div>
	</div-->

	
	
</form>
<script>
var ue = UE.getEditor('<?php echo $id?>',{
			allowDivTransToP:false,
			autoFloatEnabled:false
		});
Core.singleUploader('uploadBtn',[{title : "Image files", extensions : "jpg,gif,png"}],'1mb',function(rs){
	$('.gallery-env').append('<div class="col-sm-2 col-xs-4"><article class="image-thumb"><a href="#" class="image"><input type=hidden name="thumb[]" value="'+rs.result+'"><img src="'+WEB+'../'+rs.result+'" /></a><div class="image-options"><a href="javascript:;" class="edit" onclick="Core.editPhoto(\''+rs.result+'\')"><i class="entypo-pencil"></i></a><a href="#" class="delete"><i class="entypo-cancel"></i></a></div></article></div>');
	news_sort();
},{width:500,height:400,quality:100,crop: true});
$('#cateTree').aciTree({
    ajax: {url: 'content/getchannel?pid='},
    selectable: true
}).on('acitree', function(event, api, item, eventName, options){
	if(eventName=='selected'){
		var itemData = api.itemData(item);
		$('#cateName').text(itemData.label);
		$('[name=category_id]').val(itemData.id);
		event.preventDefault();
	}
});
$(".dropdown-menu").on("click", ".aciTreeButton", function(e) {
    e.stopPropagation();
});
$(".gallery-env").on("click", ".image-thumb .image-options a.delete", function(ev){
	ev.preventDefault();
	var $image = $(this).parents('.col-sm-2');
	$image.remove();
});
$('#biaoti').blur(function(){
	if($('#biaoti').val()!=''){					
		$.post(WEB+'content/pinyin',{word:$('#biaoti').val()},function(c){
			$('[name=en_title]').val(c);											  
		});
	}
});
function news_sort(){
	$('.gallery-env').sortable();
}
news_sort();
</script>